import com.du.spring5.bean.User;
import com.du.spring5.bean.User2;
import com.du.spring5.config.ConfigAop;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author : DuJiabao
 * @Date : 2021/2/4 11:11
 * @Project : spring
 * @File : null.java
 * @Desc :
 */
public class Demo {
  @Test
  public void test() {
    ApplicationContext context = new ClassPathXmlApplicationContext("bean1.xml");
    User user = context.getBean("user", User.class);
    user.add();
  }

  @Test
  public void test2() {
    ApplicationContext context = new ClassPathXmlApplicationContext("bean2.xml");
    User2 user2 = context.getBean("user2", User2.class);
    user2.add();
  }

  @Test
  public void test3() {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ConfigAop.class);
    User2 user2 = context.getBean("user2", User2.class);
    user2.add();
  }
}